package com.ilink.groundservice.service.InnovationPlaza;


import com.baomidou.mybatisplus.core.metadata.IPage;
import com.ilink.groundservice.entity.PO.innovationPlaza.InnovationTags;
import com.ilink.groundservice.entity.VO.innovationPlaza.CompetitionResponse;
import java.io.File;
import java.io.IOException;
import java.util.List;
import org.springframework.http.ResponseEntity;
import org.springframework.transaction.annotation.Transactional;

/**
 * <h3>new-ilink-java-backend</h3>
 *
 * @Description <p>赛事中心的接口类</p>
 * @Author pengshiyao
 * @Date 2024-09-18 22:59
 **/
public interface CompetitionService {

    IPage<CompetitionResponse> getAllCompetitions(String sentence, List<String> tags, String sortBy,
        int pageNum, int pageSize, String userId);


    IPage<CompetitionResponse> getAllCompetitionsEnd(String sentence, List<String> tags,
        String sortBy, int pageNum, int pageSize);

    CompetitionResponse getAnnouncementInfoById(Long competitionId, String userId);

    List<InnovationTags> getCommonTags();

    //已经修改为对收藏的判断
    @Transactional
    // 保证方法的事务执行，避免多步操作时出现数据不一致
    String toggleLike(Long competitionId, String userId);

    // 赛事浏览状态更新
    boolean incrementLookNum(Long competitionId);

    // 赛事分享更新
    boolean incrementShareNum(Long competitionId);

    //文档下载
    File downloadFileFromUrl(String fileUrl) throws IOException;

    ResponseEntity<Object> getFileFromLink(String link);

}
